/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJFrame.java
 *
 * Created on 28/04/2014, 9:14:55 PM
 */
package Status;

import Model.KK;
import kontrol.kontrol;
import Master.GolonganDarah;
import Master.JenisKelamin;
import Model.Pasien;
import Table.TablePasien;
import Table.TableRekamUmum;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import com.mysql.jdbc.ResultSet;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import Model.Rekam;
import Koneksi.Koneksi;

/**
 *
 * @author BIMO
 */
public class FormStatus extends javax.swing.JFrame {

    public Pasien ps;
    Connection conn = null;
    ResultSet rs = null;
    PreparedStatement pst = null;

    public void angka(String angka) {
        if (!angka.matches("[0-9]*")) {
            JOptionPane.showMessageDialog(this, "Hanya Boleh Angka");
            textNoKK.setText("");
        }
    }

    private void Fillcombo() {
        comboEditPasJK.removeAllItems();
        comboTambahPasienJenisKelamin.removeAllItems();
        String sql = "select * from JenisKelamin";
        try {
            pst = (PreparedStatement) conn.prepareStatement(sql);
            rs = (ResultSet) pst.executeQuery();
            while (rs.next()) {
                String id = rs.getString("idJK");
                String nm = rs.getString("JenisKelamin");
                comboEditPasJK.addItem(id + " " + nm);
                comboTambahPasienJenisKelamin.addItem(id + " " + nm);
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        }
    }

    private void Fillcombo2() {
        comboEditPasGD.removeAllItems();
        comboTambahPasienGolonganDarah.removeAllItems();
        String sql = "select * from GolonganDarah";
        try {
            pst = (PreparedStatement) conn.prepareStatement(sql);
            rs = (ResultSet) pst.executeQuery();
            while (rs.next()) {
                String id = rs.getString("idGD");
                comboEditPasGD.addItem(id);
                comboTambahPasienGolonganDarah.addItem(id);
            }
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, e);
        }
    }

    private void tampiKategori() throws SQLException {
        String s = textNoKK.getText();

        List<Pasien> daftarPasien = kontrol.getkoneksi().lihatTable(Integer.parseInt(s));

        TablePasien model = new TablePasien(daftarPasien);
        tableCariPasien.setModel(model);
    }

    /** Creates new form NewJFrame */
    public FormStatus() {
        initComponents();

    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktopPane1 = new javax.swing.JDesktopPane();
        internalEditPasien = new javax.swing.JInternalFrame();
        jPanel2 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        textEditPasNoKK = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        textEditPasNoIndex = new javax.swing.JTextField();
        textEditPasNamaPasien = new javax.swing.JTextField();
        textEditPasAgama = new javax.swing.JTextField();
        textEditPasPekerjaan = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        comboEditPasJK = new javax.swing.JComboBox();
        comboEditPasGD = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        dateEditPasTglLahir = new com.toedter.calendar.JDateChooser();
        buttonSimpanEdit = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        internalKeluhan = new javax.swing.JInternalFrame();
        jPanel4 = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        textNamaKKKeluhan = new javax.swing.JTextField();
        textNoKKKeluhan = new javax.swing.JTextField();
        jScrollPane7 = new javax.swing.JScrollPane();
        textAlamatKeluhan = new javax.swing.JTextArea();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jScrollPane8 = new javax.swing.JScrollPane();
        textKeluhan = new javax.swing.JTextArea();
        textNamaPasienKeluhan = new javax.swing.JTextField();
        textNoIndexKeluhan = new javax.swing.JTextField();
        comboJenisKelaminKeluhan = new javax.swing.JComboBox();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        comboGolonganDarahKeluhan = new javax.swing.JComboBox();
        jLabel23 = new javax.swing.JLabel();
        comboPoli = new javax.swing.JComboBox();
        buttonSimpanKeluhan = new javax.swing.JButton();
        jLabel24 = new javax.swing.JLabel();
        textAgamaKeluhan = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        textPekerjaanKeluhan = new javax.swing.JTextField();
        dateKunjungan = new com.toedter.calendar.JDateChooser();
        jButton1 = new javax.swing.JButton();
        internalTambahKK = new javax.swing.JInternalFrame();
        jPanel3 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        textTambahNamaKK = new javax.swing.JTextField();
        textTambahNoKK = new javax.swing.JTextField();
        jScrollPane3 = new javax.swing.JScrollPane();
        textTambahAlamat = new javax.swing.JTextArea();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        internalTambahPasien = new javax.swing.JInternalFrame();
        jPanel5 = new javax.swing.JPanel();
        jLabel26 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        jLabel28 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        textTambahPasienNamaPasien = new javax.swing.JTextField();
        textTambahPasienAgama = new javax.swing.JTextField();
        textTambahPasienPekerjaan = new javax.swing.JTextField();
        textTambahPasienNoIndex = new javax.swing.JTextField();
        textTambahPasienNoKK = new javax.swing.JTextField();
        comboTambahPasienGolonganDarah = new javax.swing.JComboBox();
        comboTambahPasienJenisKelamin = new javax.swing.JComboBox();
        dateTambahPasienTanggalLahir = new com.toedter.calendar.JDateChooser();
        buttonSimpanTambahPasien = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        textNamaKK = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        textAlamat = new javax.swing.JTextArea();
        textNoKK = new javax.swing.JTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        tableCariPasien = new javax.swing.JTable();
        buttonEdit = new javax.swing.JButton();
        buttonLihatRekam = new javax.swing.JButton();
        buttonTambahKeluhan = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jDesktopPane1.setBackground(new java.awt.Color(255, 255, 255));

        internalEditPasien.getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel4.setText("No KK");

        jLabel5.setText("No Index");

        jLabel6.setText("Nama Pasien");

        jLabel7.setText("Agama");

        textEditPasNoKK.setEnabled(false);

        jLabel8.setText("Pekerjaan");

        textEditPasNoIndex.setEnabled(false);

        textEditPasNamaPasien.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textEditPasNamaPasienActionPerformed(evt);
            }
        });

        jLabel9.setText("Jenis Kelamin");

        comboEditPasJK.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        comboEditPasGD.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jLabel10.setText("Golongan Darah");

        jLabel11.setText("Tanggal Lahir");

        buttonSimpanEdit.setText("Edit");
        buttonSimpanEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSimpanEditActionPerformed(evt);
            }
        });

        jButton2.setText("Batal");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                        .addGap(174, 174, 174)
                        .addComponent(buttonSimpanEdit)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE)
                        .addComponent(jButton2))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6)
                            .addComponent(jLabel7)
                            .addComponent(jLabel8)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textEditPasPekerjaan, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE)
                            .addComponent(textEditPasNoIndex, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE)
                            .addComponent(textEditPasNoKK, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE)
                            .addComponent(textEditPasNamaPasien, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE)
                            .addComponent(textEditPasAgama, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE))))
                .addGap(28, 28, 28)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addComponent(jLabel10)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                            .addComponent(jLabel11)
                            .addGap(75, 75, 75))))
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(comboEditPasJK, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dateEditPasTglLahir, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboEditPasGD, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(135, 135, 135))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(107, 107, 107)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(textEditPasNoKK, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(textEditPasNoIndex, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboEditPasJK, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(textEditPasNamaPasien, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboEditPasGD, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7)
                            .addComponent(textEditPasAgama, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(textEditPasPekerjaan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(dateEditPasTglLahir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(40, 40, 40)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonSimpanEdit)
                    .addComponent(jButton2))
                .addContainerGap(78, Short.MAX_VALUE))
        );

        internalEditPasien.getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 700, 420));

        internalEditPasien.setBounds(0, 0, 720, 450);
        jDesktopPane1.add(internalEditPasien, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel14.setText("No KK");

        jLabel15.setText("Nama KK");

        jLabel16.setText("Alamat");

        textNamaKKKeluhan.setEnabled(false);

        textNoKKKeluhan.setEnabled(false);

        textAlamatKeluhan.setColumns(20);
        textAlamatKeluhan.setRows(5);
        textAlamatKeluhan.setEnabled(false);
        jScrollPane7.setViewportView(textAlamatKeluhan);

        jLabel17.setText("No Index");

        jLabel18.setText("Nama Pasien");

        jLabel19.setText("Keluhan");

        textKeluhan.setColumns(20);
        textKeluhan.setRows(5);
        jScrollPane8.setViewportView(textKeluhan);

        textNamaPasienKeluhan.setEnabled(false);

        textNoIndexKeluhan.setEnabled(false);

        comboJenisKelaminKeluhan.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        comboJenisKelaminKeluhan.setEnabled(false);

        jLabel20.setText("Jenis Kelamin");

        jLabel21.setText("Golongan Darah");

        comboGolonganDarahKeluhan.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        comboGolonganDarahKeluhan.setEnabled(false);

        jLabel23.setText("Poliklinik");

        comboPoli.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Poli Umum", "Poli Gigi", "Poli KIA" }));

        buttonSimpanKeluhan.setText("Simpan");
        buttonSimpanKeluhan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSimpanKeluhanActionPerformed(evt);
            }
        });

        jLabel24.setText("Agama");

        textAgamaKeluhan.setEnabled(false);

        jLabel25.setText("Pekerjaan");

        textPekerjaanKeluhan.setEnabled(false);

        dateKunjungan.setEnabled(false);

        jButton1.setText("Batal");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel15)
                            .addComponent(jLabel14)
                            .addComponent(jLabel16)
                            .addComponent(jLabel19))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jScrollPane8)
                            .addComponent(textNoKKKeluhan)
                            .addComponent(textNamaKKKeluhan, javax.swing.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE)
                            .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel20)
                                .addGap(18, 18, 18)
                                .addComponent(comboJenisKelaminKeluhan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel21)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(comboGolonganDarahKeluhan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel23)
                                .addGap(44, 44, 44)
                                .addComponent(comboPoli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel18)
                                    .addComponent(jLabel17)
                                    .addComponent(jLabel24)
                                    .addComponent(jLabel25))
                                .addGap(20, 20, 20)
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(textPekerjaanKeluhan)
                                    .addComponent(textAgamaKeluhan)
                                    .addComponent(textNoIndexKeluhan)
                                    .addComponent(textNamaPasienKeluhan, javax.swing.GroupLayout.DEFAULT_SIZE, 196, Short.MAX_VALUE)))))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(155, 155, 155)
                        .addComponent(buttonSimpanKeluhan)
                        .addGap(18, 18, 18)
                        .addComponent(jButton1)))
                .addContainerGap(18, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap(448, Short.MAX_VALUE)
                .addComponent(dateKunjungan, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(dateKunjungan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(96, 96, 96)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(textNoKKKeluhan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17)
                    .addComponent(textNoIndexKeluhan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(textNamaKKKeluhan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18)
                    .addComponent(textNamaPasienKeluhan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel24)
                            .addComponent(textAgamaKeluhan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel25)
                            .addComponent(textPekerjaanKeluhan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel20)
                            .addComponent(comboJenisKelaminKeluhan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel16)
                    .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel19)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel4Layout.createSequentialGroup()
                            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel21)
                                .addComponent(comboGolonganDarahKeluhan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 56, Short.MAX_VALUE)
                            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel23)
                                .addComponent(comboPoli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(41, 41, 41)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonSimpanKeluhan)
                    .addComponent(jButton1))
                .addContainerGap(56, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout internalKeluhanLayout = new javax.swing.GroupLayout(internalKeluhan.getContentPane());
        internalKeluhan.getContentPane().setLayout(internalKeluhanLayout);
        internalKeluhanLayout.setHorizontalGroup(
            internalKeluhanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        internalKeluhanLayout.setVerticalGroup(
            internalKeluhanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        internalKeluhan.setBounds(0, 0, 620, 550);
        jDesktopPane1.add(internalKeluhan, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel12.setText("No KK");

        jLabel13.setText("Nama KK");

        jLabel22.setText("Alamat");

        textTambahAlamat.setColumns(20);
        textTambahAlamat.setRows(5);
        jScrollPane3.setViewportView(textTambahAlamat);

        jButton3.setText("Simpan");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setText("Batal");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel13)
                            .addComponent(jLabel12)
                            .addComponent(jLabel22))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE)
                            .addComponent(textTambahNamaKK)
                            .addComponent(textTambahNoKK)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(144, 144, 144)
                        .addComponent(jButton3)
                        .addGap(18, 18, 18)
                        .addComponent(jButton4)))
                .addContainerGap(207, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(151, 151, 151)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(textTambahNoKK, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(textTambahNamaKK, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel22))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton3)
                    .addComponent(jButton4))
                .addContainerGap(69, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout internalTambahKKLayout = new javax.swing.GroupLayout(internalTambahKK.getContentPane());
        internalTambahKK.getContentPane().setLayout(internalTambahKKLayout);
        internalTambahKKLayout.setHorizontalGroup(
            internalTambahKKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        internalTambahKKLayout.setVerticalGroup(
            internalTambahKKLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(internalTambahKKLayout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(27, Short.MAX_VALUE))
        );

        internalTambahKK.setBounds(0, 0, 650, 490);
        jDesktopPane1.add(internalTambahKK, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel26.setText("No KK");

        jLabel27.setText("No Index");

        jLabel28.setText("Nama Pasien");

        jLabel29.setText("Agama");

        jLabel30.setText("Pekerjaan");

        jLabel31.setText("Jenis Kelamin");

        jLabel32.setText("Golongan Darah");

        jLabel33.setText("Tanggal Lahir");

        comboTambahPasienGolonganDarah.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        comboTambahPasienJenisKelamin.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        buttonSimpanTambahPasien.setText("Simpan");
        buttonSimpanTambahPasien.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonSimpanTambahPasienActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel28)
                            .addComponent(jLabel29)
                            .addComponent(jLabel30)
                            .addComponent(jLabel27)
                            .addComponent(jLabel26))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(textTambahPasienNoKK)
                            .addComponent(textTambahPasienNoIndex)
                            .addComponent(textTambahPasienPekerjaan)
                            .addComponent(textTambahPasienAgama)
                            .addComponent(textTambahPasienNamaPasien, javax.swing.GroupLayout.DEFAULT_SIZE, 264, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel32)
                            .addComponent(jLabel31)
                            .addComponent(jLabel33))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(dateTambahPasienTanggalLahir, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(comboTambahPasienJenisKelamin, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(comboTambahPasienGolonganDarah, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(191, 191, 191)
                        .addComponent(buttonSimpanTambahPasien)))
                .addContainerGap(111, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(160, 160, 160)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(textTambahPasienNoKK, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel31)
                    .addComponent(comboTambahPasienJenisKelamin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(textTambahPasienNoIndex, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel32)
                    .addComponent(comboTambahPasienGolonganDarah, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel28)
                            .addComponent(textTambahPasienNamaPasien, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel33))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addComponent(jLabel29)
                                .addGap(18, 18, 18)
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel30)
                                    .addComponent(textTambahPasienPekerjaan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(textTambahPasienAgama, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(dateTambahPasienTanggalLahir, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(49, 49, 49)
                .addComponent(buttonSimpanTambahPasien)
                .addContainerGap(172, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout internalTambahPasienLayout = new javax.swing.GroupLayout(internalTambahPasien.getContentPane());
        internalTambahPasien.getContentPane().setLayout(internalTambahPasienLayout);
        internalTambahPasienLayout.setHorizontalGroup(
            internalTambahPasienLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        internalTambahPasienLayout.setVerticalGroup(
            internalTambahPasienLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        internalTambahPasien.setBounds(0, 0, 680, 600);
        jDesktopPane1.add(internalTambahPasien, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel1.setText("No KK");

        jLabel2.setText("Nama KK");

        jLabel3.setText("Alamat");

        textNamaKK.setEnabled(false);

        textAlamat.setColumns(20);
        textAlamat.setRows(5);
        textAlamat.setEnabled(false);
        jScrollPane1.setViewportView(textAlamat);

        textNoKK.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                textNoKKActionPerformed(evt);
            }
        });
        textNoKK.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                textNoKKKeyReleased(evt);
            }
        });

        tableCariPasien.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        tableCariPasien.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tableCariPasienMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tableCariPasien);

        buttonEdit.setText("Edit Pasien");
        buttonEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonEditActionPerformed(evt);
            }
        });

        buttonLihatRekam.setText("Lihat Rekam");
        buttonLihatRekam.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonLihatRekamActionPerformed(evt);
            }
        });

        buttonTambahKeluhan.setText("Tambah Keluhan");
        buttonTambahKeluhan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonTambahKeluhanActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel1))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(textNoKK)
                    .addComponent(jScrollPane1)
                    .addComponent(textNamaKK, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE))
                .addContainerGap(333, Short.MAX_VALUE))
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 720, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(85, 85, 85)
                .addComponent(buttonEdit)
                .addGap(18, 18, 18)
                .addComponent(buttonLihatRekam)
                .addGap(18, 18, 18)
                .addComponent(buttonTambahKeluhan)
                .addContainerGap(312, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(185, 185, 185)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(textNoKK, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(textNamaKK, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonEdit)
                    .addComponent(buttonLihatRekam)
                    .addComponent(buttonTambahKeluhan))
                .addContainerGap(62, Short.MAX_VALUE))
        );

        jPanel1.setBounds(0, 0, 720, 650);
        jDesktopPane1.add(jPanel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        getContentPane().add(jDesktopPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 720, 650));

        jMenuItem1.setText("Logout");
        jMenu1.add(jMenuItem1);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Tambah");

        jMenuItem2.setText("Tambah KK");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem2);

        jMenuItem3.setText("Tambah Pasien");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem3);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void buttonEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonEditActionPerformed
        internalEditPasien.setVisible(true);
        textEditPasNoKK.setText(textNoKK.getText());
        try {
            Pasien pas = new Pasien();
            int row = tableCariPasien.getSelectedRow();
            String a = (String) tableCariPasien.getModel().getValueAt(row, 0);
            pas.setNoIndex(a);

            kontrol.getkoneksi().cariPasien(pas);
            textEditPasNoIndex.setText(a);
            textEditPasAgama.setText(pas.getAgama());
            textEditPasNamaPasien.setText(pas.getNamaPasien());
            textEditPasPekerjaan.setText(pas.getPekerjaan());

            DateFormat df = new SimpleDateFormat("dd-MM-yy"); //adjust this according to your requirement
            Date gDate = null;
            try {
                gDate = df.parse(pas.getTanggalLahir());
//            hDate = df.parse(h);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            dateEditPasTglLahir.setDate(gDate);


        } catch (SQLException ex) {
            Logger.getLogger(FormStatus.class.getName()).log(Level.SEVERE, null, ex);
        }



// TODO add your handling code here:
    }//GEN-LAST:event_buttonEditActionPerformed

    private void textNoKKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textNoKKActionPerformed
    }//GEN-LAST:event_textNoKKActionPerformed

    private void textNoKKKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textNoKKKeyReleased
        angka(textNoKK.getText());
        try {
            KK kk = new KK();

            int kode = Integer.parseInt(textNoKK.getText());
            kk.setNoKK(kode);
            kontrol.getkoneksi().cariKK(kk);
            textNamaKK.setText(kk.getNamaKK());
            textAlamat.setText(kk.getAlamat());
            tampiKategori();

        } catch (SQLException ex) {
            Logger.getLogger(FormStatus.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_textNoKKKeyReleased

    private void textEditPasNamaPasienActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textEditPasNamaPasienActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_textEditPasNamaPasienActionPerformed

    private void tableCariPasienMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tableCariPasienMouseClicked
        int row = tableCariPasien.getSelectedRow();


        // TODO add your handling code here:
    }//GEN-LAST:event_tableCariPasienMouseClicked

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        conn = (Connection) Koneksi.ConnectDb();
        Fillcombo();
        Fillcombo2();         // TODO add your handling code here:
    }//GEN-LAST:event_formWindowOpened

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        internalEditPasien.setVisible(false);        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2ActionPerformed

    private void buttonSimpanEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSimpanEditActionPerformed
        Pasien pasien = new Pasien();

        JenisKelamin jk = new JenisKelamin();
        GolonganDarah gd = new GolonganDarah();
        kontrol kontrolkk;
        pasien.setNoIndex(textEditPasNoIndex.getText());
        pasien.setNamaPasien(textEditPasNamaPasien.getText());
        pasien.setAgama(textEditPasAgama.getText());
        pasien.setPekerjaan(textEditPasPekerjaan.getText());

        String kode = comboEditPasJK.getItemAt(comboEditPasJK.getSelectedIndex()).toString();
        String kd = kode.substring(0, 1);
        jk.setIdJenisKelamin(Integer.parseInt(kd));
        String gol = comboEditPasGD.getItemAt(comboEditPasGD.getSelectedIndex()).toString();

        gd.setIdGolonganDarah(gol);
        pasien.setGolonganDarah(gd);
        pasien.setJenisKelamin(jk);


        Date dt = dateEditPasTglLahir.getDate();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String tanggal = sdf.format(dt);
        pasien.setTanggalLahir(tanggal);





        kontrol kon;
        try {
            kon = kontrol.getkoneksi();
            kon.updatePasien(pasien);
            JOptionPane.showMessageDialog(rootPane, "Pasien dengan No Index: " + textEditPasNoIndex.getText() + "\nBerhasil diubah");
        } catch (SQLException ex) {
            Logger.getLogger(FormStatus.class.getName()).log(Level.SEVERE, null, ex);
        }


    }//GEN-LAST:event_buttonSimpanEditActionPerformed

    private void buttonLihatRekamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonLihatRekamActionPerformed
        Pasien pas = new Pasien();
        int row = tableCariPasien.getSelectedRow();
        String a = (String) tableCariPasien.getModel().getValueAt(row, 0);
        String b = (String) tableCariPasien.getModel().getValueAt(row, 1);
        LihatRekam rekam = new LihatRekam();
        pas.setNoIndex(a);

        pas.setNamaPasien(b);
        rekam.textNoIndex2.setText(a);
        rekam.textNamaPasien2.setText(b);

        rekam.setVisible(true);
        try {
            List<Rekam> rekamUmum = kontrol.getkoneksi().lihatRekamUmum(a);
            TableRekamUmum model = new TableRekamUmum(rekamUmum);
            rekam.tableRekamUmum.setModel(model);
        } catch (SQLException ex) {
            Logger.getLogger(FormStatus.class.getName()).log(Level.SEVERE, null, ex);
        }




        // TODO add your handling code here:
    }//GEN-LAST:event_buttonLihatRekamActionPerformed

    private void buttonTambahKeluhanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonTambahKeluhanActionPerformed

        Date current = new Date();
        SimpleDateFormat frmt = new SimpleDateFormat("dd-MM-yy");

        dateKunjungan.setDate(current);
        internalKeluhan.setVisible(true);
        textNoKKKeluhan.setText(textNoKK.getText());
        textNamaKKKeluhan.setText(textNamaKK.getText());
        textAlamatKeluhan.setText(textAlamat.getText());
        comboGolonganDarahKeluhan.removeAllItems();
        comboJenisKelaminKeluhan.removeAllItems();

        try {
            Pasien pas = new Pasien();
            JenisKelamin jk = new JenisKelamin();
            GolonganDarah gd = new GolonganDarah();
            int row = tableCariPasien.getSelectedRow();
            String a = (String) tableCariPasien.getModel().getValueAt(row, 0);
            pas.setNoIndex(a);

            kontrol.getkoneksi().cariPasien(pas);
            textNoIndexKeluhan.setText(a);

            textAgamaKeluhan.setText(pas.getAgama());
            textNamaPasienKeluhan.setText(pas.getNamaPasien());
            textPekerjaanKeluhan.setText(pas.getPekerjaan());
//            String tanggal = pas.getTanggalLahir();

//            System.out.println(pas.getGolonganDarah().getIdGolonganDarah());
       comboGolonganDarahKeluhan.addItem(pas.getGolonganDarah().getIdGolonganDarah());
       comboJenisKelaminKeluhan.addItem(pas.getJenisKelamin().getJenisKelamin());



        } catch (SQLException ex) {
            Logger.getLogger(FormStatus.class.getName()).log(Level.SEVERE, null, ex);
        }// TODO add your handling code here:
    }//GEN-LAST:event_buttonTambahKeluhanActionPerformed

    private void buttonSimpanKeluhanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSimpanKeluhanActionPerformed

        Pasien pasien = new Pasien();
        Rekam rekam = new Rekam();
        kontrol kontrolkk;

        pasien.setNoIndex(textNoIndexKeluhan.getText());

        rekam.setKeluhan(textKeluhan.getText());
        rekam.setNoIndex(pasien);

        Date dt = dateKunjungan.getDate();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String tanggal = sdf.format(dt);
        rekam.setTglBerkunjung(tanggal);



        try {
            kontrolkk = kontrol.getkoneksi();

            if (comboPoli.getSelectedItem() == "Poli Umum") {
                kontrolkk.tambahKeluhanUmum(rekam);
                JOptionPane.showMessageDialog(rootPane, "Keluhan Berhasil Ditambahkan");
                internalKeluhan.setVisible(false);
            }

        } catch (SQLException ex) {
            internalKeluhan.setVisible(false);
            Logger.getLogger(FormStatus.class.getName()).log(Level.SEVERE, null, ex);
        }        // TODO add your handling code here:
    }//GEN-LAST:event_buttonSimpanKeluhanActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        internalKeluhan.setVisible(false);        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed

        KK kk = new KK();

        kontrol k;
        kk.setNoKK(Integer.parseInt(textTambahNoKK.getText()));
        kk.setNamaKK(textTambahNamaKK.getText());
        kk.setAlamat(textTambahAlamat.getText());
        try {
            k = kontrol.getkoneksi();
            k.tambahKK(kk);
            textTambahPasienNoKK.setText(textTambahNoKK.getText());
            textTambahPasienNoKK.setEnabled(false);
            JOptionPane.showMessageDialog(rootPane, "No KK: " + textTambahNoKK.getText() + "\nNama KK: " + textTambahNamaKK.getText() + "\n"
                    + "Alamat: " + textTambahAlamat.getText() + "\nBerhasil Disimpan");

            internalTambahPasien.setVisible(true);
            internalTambahKK.setVisible(false);
        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(rootPane, ex);
        }        // TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed

    private void buttonSimpanTambahPasienActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSimpanTambahPasienActionPerformed
        Pasien pasien = new Pasien();
        KK kk = new KK();
        JenisKelamin jk = new JenisKelamin();
        GolonganDarah gd = new GolonganDarah();
        kontrol kontrolkk;
        pasien.setNoIndex(textTambahPasienNoIndex.getText());
        pasien.setNamaPasien(textTambahPasienNamaPasien.getText());
        pasien.setAgama(textTambahPasienAgama.getText());
        pasien.setPekerjaan(textTambahPasienPekerjaan.getText());
        kk.setNoKK(Integer.parseInt(textTambahPasienNoKK.getText()));
        pasien.setNoKK(kk);

        String kode = comboTambahPasienJenisKelamin.getItemAt(comboTambahPasienJenisKelamin.getSelectedIndex()).toString();
        String kd = kode.substring(0, 1);
        jk.setIdJenisKelamin(Integer.parseInt(kd));
        String gol = comboTambahPasienGolonganDarah.getItemAt(comboTambahPasienGolonganDarah.getSelectedIndex()).toString();

        gd.setIdGolonganDarah(gol);
        pasien.setGolonganDarah(gd);
        pasien.setJenisKelamin(jk);


        Date dt = dateTambahPasienTanggalLahir.getDate();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String tanggal = sdf.format(dt);
        pasien.setTanggalLahir(tanggal);



        try {
            kontrolkk = kontrol.getkoneksi();
            kontrolkk.tambahPasien(pasien);
            JOptionPane.showMessageDialog(rootPane, "Data :\n No KK : " + textTambahPasienNoKK.getText() + "\nNo Index: " + textTambahPasienNoKK.getText()
                    + "-" + textTambahPasienNoIndex.getText() + "\nNama " + textTambahPasienNamaPasien.getText() + "\nGolongan Darah: "
                    + comboTambahPasienGolonganDarah.getSelectedItem() + "\n" + "Jenis Kelamin: " + comboTambahPasienJenisKelamin.getSelectedItem()
                    + "\nTanggal Lahir: " + tanggal + "\nBerhasil Disimpan");
            internalTambahPasien.setVisible(false);
            tampiKategori();
        } catch (SQLException ex) {
            Logger.getLogger(FormStatus.class.getName()).log(Level.SEVERE, null, ex);
        }              // TODO add your handling code here:
    }//GEN-LAST:event_buttonSimpanTambahPasienActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        internalTambahPasien.setVisible(true);          // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        internalTambahKK.setVisible(true);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new FormStatus().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton buttonEdit;
    private javax.swing.JButton buttonLihatRekam;
    private javax.swing.JButton buttonSimpanEdit;
    private javax.swing.JButton buttonSimpanKeluhan;
    private javax.swing.JButton buttonSimpanTambahPasien;
    private javax.swing.JButton buttonTambahKeluhan;
    private javax.swing.JComboBox comboEditPasGD;
    private javax.swing.JComboBox comboEditPasJK;
    private javax.swing.JComboBox comboGolonganDarahKeluhan;
    private javax.swing.JComboBox comboJenisKelaminKeluhan;
    private javax.swing.JComboBox comboPoli;
    private javax.swing.JComboBox comboTambahPasienGolonganDarah;
    private javax.swing.JComboBox comboTambahPasienJenisKelamin;
    private com.toedter.calendar.JDateChooser dateEditPasTglLahir;
    private com.toedter.calendar.JDateChooser dateKunjungan;
    private com.toedter.calendar.JDateChooser dateTambahPasienTanggalLahir;
    private javax.swing.JInternalFrame internalEditPasien;
    private javax.swing.JInternalFrame internalKeluhan;
    private javax.swing.JInternalFrame internalTambahKK;
    private javax.swing.JInternalFrame internalTambahPasien;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JTable tableCariPasien;
    private javax.swing.JTextField textAgamaKeluhan;
    private javax.swing.JTextArea textAlamat;
    private javax.swing.JTextArea textAlamatKeluhan;
    private javax.swing.JTextField textEditPasAgama;
    private javax.swing.JTextField textEditPasNamaPasien;
    private javax.swing.JTextField textEditPasNoIndex;
    private javax.swing.JTextField textEditPasNoKK;
    private javax.swing.JTextField textEditPasPekerjaan;
    private javax.swing.JTextArea textKeluhan;
    private javax.swing.JTextField textNamaKK;
    private javax.swing.JTextField textNamaKKKeluhan;
    private javax.swing.JTextField textNamaPasienKeluhan;
    private javax.swing.JTextField textNoIndexKeluhan;
    private javax.swing.JTextField textNoKK;
    private javax.swing.JTextField textNoKKKeluhan;
    private javax.swing.JTextField textPekerjaanKeluhan;
    private javax.swing.JTextArea textTambahAlamat;
    private javax.swing.JTextField textTambahNamaKK;
    private javax.swing.JTextField textTambahNoKK;
    private javax.swing.JTextField textTambahPasienAgama;
    private javax.swing.JTextField textTambahPasienNamaPasien;
    private javax.swing.JTextField textTambahPasienNoIndex;
    private javax.swing.JTextField textTambahPasienNoKK;
    private javax.swing.JTextField textTambahPasienPekerjaan;
    // End of variables declaration//GEN-END:variables
}
